#pragma once
#include <iostream>
#include <string>
#include <ctime>

#define NORMAL 1
#define WARNING 2
#define DEBUG 3
#define FATAL 4

#define LOG(LEVEL, MESSAGE) log(#LEVEL, MESSAGE, __FILE__, __LINE__)

void log(std::string level, std::string message, std::string file, int line)
{
    time_t rawtime;
    struct tm *timeinfo;
    time(&rawtime);
    timeinfo = localtime(&rawtime);
    std::cout << "[" << level << "][";
    printf("%d年%02d月%02d日", timeinfo->tm_year + 1900, timeinfo->tm_mon + 1, timeinfo->tm_mday);
    printf("%02d时%02d分%02d秒", timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec);
    std::cout << "][" << message << "][" << file << ": " << line << "]" << std::endl;
}
